<?php

/**
 * Add JavaScript 
 *
 * @package Rapide_View
 */
class Rapide_View_Helper_Js extends Rapide_View_Helper
{
	/**
	 * Add JavaScript
	 *
	 * @param string $sJs JavaScript file name
	 */
	public function execute($sJs)
	{
		$oView = $this->getView();

		if(!$oView instanceof Rapide_View_Html)
			return;

		$sSrc = Rapide_Controller_Front::getInstance()
						->getRouter()
						->url();

		$sJs = $sSrc . 'Template/js/' . $sJs;

		$sJsAttribute = Rapide_View_Html::JS_ATTRIBUTE;

		$aJs	 = $oView->$sJsAttribute;
		$aJs[] = $sJs;
		$oView->$sJsAttribute = $aJs;
	}
}

?>